package com.power.project.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;
import org.springframework.data.repository.query.Param;
import com.power.project.model.P_project;

import javax.transaction.Transactional;
import java.io.Serializable;
import java.util.List;

/**
 * 项目 持久层(hibernate)
 */

public interface P_projectDao extends JpaRepository<P_project, Serializable>, JpaSpecificationExecutor<P_project>, Repository<P_project, Serializable>, P_projectDaoCustom<P_project, Serializable> {

   @Modifying
   @Transactional
   @Query("update P_project s set s.deleted = 1 where  s.id in (:ids) ")
   void removeByIds(@Param("ids") List<Integer> ids);

   @Modifying
   @Transactional
   @Query("update P_project s set s.deleted = 1 where  s.id = ?1 ")
   void removeById(Serializable id);

    Long countByProjectcode(String projectCode);

   @Modifying
   @Transactional
   @Query("update P_project s set s.mgruserids = ?2 where  s.id = ?1 ")
   void updateMgruseridsById(Serializable id,String mgruserids);
}
